#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

commit_msg=`cat $1`

msg_re="^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(\(.+\))?: .{1,50}"

if [[ ! $commit_msg =~ $msg_re ]]
then
	echo "不合法的 commit 消息提交格式，请使用正确的格式："
	echo "feat(compiler): add 'comments' option"
	echo "fix(v-model): handle events on blur (close #28)"
	echo "请查看 git commit 提交规范：https://github.com/woai3c/Front-end-articles/blob/master/git%20commit%20style.md"

	exit 1
fi
